class Solution(object):
    def findMinArrowShots(self, points):
        """
        :type points: List[List[int]]
        :rtype: int
        """
        points.sort()
        n = len(points)
        last = points[0]
        count = 0
        for i in range(n):
            if points[i][0] <= last[1]:
                last = [points[i][0], min(last[1], points[i][1])]
            else:
                count += 1
                last = points[i]
        count += 1
        return count



data = Solution()
points = [[1, 2], [3, 4], [5, 6], [7, 8]]
print(data.findMinArrowShots(points))
